package com.xd.controller;/**
 * Created by mac on 2019/5/21.
 */

import com.xd.dto.AuditDto;
import com.xd.service.AuditService;
import com.xd.util.MyUtil;
import com.xd.vo.AuditVo;
import com.xd.vo.DetailVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.websocket.server.PathParam;
import java.io.File;
import java.io.IOException;
import java.util.List;

/**
 * @author KANADE_XD
 * @date 2019/5/21 8:44 AM
 * @definition 人力资源的控制层
 */

@RestController
@RequestMapping("/hr")
@Slf4j
public class AuditController {
    @Resource
    AuditService auditService;

    @RequestMapping("/getall")
    public List<AuditDto> findall() {
        return auditService.findall();
    }

    @RequestMapping("/addmsg")
    public void addmsg(@RequestBody AuditVo auditVo) {
        auditService.addmsg(auditVo);
    }

    @RequestMapping("/getdetail")
    public DetailVo getdetail(Long id) {
        return auditService.getdetail(id);
    }

    @PostMapping("/picture")
    public String test(HttpServletRequest req, MultipartHttpServletRequest multiReq) {
        auditService.saveIndexImage(req, multiReq);
        return "success";
    }

    @RequestMapping("/delmsg")
    public void delmsg(Long id) {
        System.out.println("****1***"+id);
        auditService.deleteById(id);
    }

}
